

'''
反转字符串
'''
eStr=["h","e","l","l","o"]
outputStr=["o","l","l","e","h"]

eStr.reverse()

双向指针
i, j = 0, len(eStr)-1
while i<j:
    eStr[i], eStr[j]=eStr[j],eStr[i]
    i+=1
    j-=1

'''
反转字符串里的单词
'''
rStr = "the sky is blue"
方法一
newrStr = rStr.split()
i, j = 0, len(newrStr)-1
while i < j:
    newrStr[i], newrStr[j] = newrStr[j], newrStr[i]
    i+=1
    j-=1
print(' '.join(newrStr))
# 方法二
print(' '.join(rStr.split()[::-1]))

